<%-- 
    Document   : showCamp
    Created on : 19-mag-2014, 21.24.58
    Author     : Fede programmer
--%>

<%@page import="entity.Campo"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>SportingEventClub - Campo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="CSS/BaseSite.css" />   
        <link rel="stylesheet" type="text/css" href="CSS/vertical-ticker.css"/>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script type="text/javascript" src="JQuery/jquery.totemticker.js"></script>
        <script type="text/javascript" src="JQuery/chainedmenu.js"></script>
        <script type="text/javascript" src="JQuery/config.js"></script>
        <link rel="shortcut icon" href= "Images/stadion-icon.png"/>
        <title>showCamp</title>
        <script language="javascript" type="text/javascript">
            function call(sport)
            {                   
                array = sport.split("-");
                                
                var xmlhttp;   
                
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {
                        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                    }
                }
                
                xmlhttp.open("GET","ServletPortaleCampi?op=ricerca&sport="+array[0]+"&campo="+array[1]+"&orario="+array[2],true);
                xmlhttp.send();
            }                                                                                  
        </script>
    </head>
        <%
            List<Campo> allCamps = (List<Campo>) request.getAttribute("allCamps");
            String op = (String)request.getAttribute("op");
            if(op.equals("ricerca")){
                List<Campo> listaCampi = (List<Campo>) request.getAttribute("listacampi");
                String sport = (String)request.getAttribute("sport");
                String campo = (String)request.getAttribute("campo");
                String orario = (String)request.getAttribute("orario");
                if(!listaCampi.isEmpty()){
        %>
                    <h3 style="margin-left:25px;">Campi da <%=sport%> in <%=campo%> disponibili alle ore <%=orario%> :</h3>
                    <form name="fastSearch">
                        <table border="0" align="center">
                            <%int i = 0;%>
                            <tr>
                                <%
                                    for(Campo item : listaCampi){
                                        if(i < 3){
                                %>
                                            <td>
                                                <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=item.getNumeroCampo()%>" >
                                                    <img class="imageborder" src="<%=item.getImmagine()%>" width="200" heigth="200">                                            
                                                    <h3 align="center">Campo numero: <%=item.getNumeroCampo()%></h3>
                                                </a>
                                            <td>
                                <%      }i++;%>
                                <%  }%>
                            </tr>
                        </table>
                    </form>
                <%}else{%>
                    <h3 style="margin-left:25px;">Siamo spiacenti al momento non ci sono campi disponibili!</h3>
                <%}%>
            <%}else{%>
                <body onload="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'saveit')">
                    <div class="main">
                        <div class="page">
                            <div class="header">       
                                <div class="login">
                                    <%@include file="login.jsp"%>
                                </div>
                                <div class="banner">
                                </div>
                                <div class="topmenu">
                                    <%@include file="topmenu.jsp" %>
                                </div>
                            </div>
                            <div class="content">
                                <div class="content-in">
                                    <div class="left-panel">
                                        <div class="left-panel-in">                                           
                                            <div id="map">
                                                <!--<img src="solar_system.jpg" alt="solar system" title="solar system" />-->
                                                <img class="imageborder" src="Images/mappacampi.jpg" alt="mappacampi" usemap="#mappacampi"/>
                                                <ul>		
                                                    <li id="ct1">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(2).getNumeroCampo()%>" class="tl">
                                                            ct1
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_top"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(2).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(2).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>    
                                                    <li id="ct2">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(3).getNumeroCampo()%>" class="tl">
                                                            ct2
                                                        </a>
                                                        <div class="xsnazzy">		
                                                            <em class="point_top"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(3).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(3).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="ct3">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(6).getNumeroCampo()%>" class="tl">
                                                            ct3
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_top"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(6).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>                                                                    
                                                                    <p>Campo :<%=allCamps.get(6).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="cb1">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(4).getNumeroCampo()%>" class="tl">
                                                            cb1
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_right"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(4).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(4).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>    
                                                    <li id="cb2">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(5).getNumeroCampo()%>" class="tl">
                                                            cb2
                                                        </a>
                                                        <div class="xsnazzy">	
                                                            <em class="point_right"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(5).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(5).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="cc1">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(0).getNumeroCampo()%>" class="tl">
                                                            cc1
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_left"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(0).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(0).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>    
                                                    <li id="cc2">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(1).getNumeroCampo()%>" class="tl">
                                                            cc2
                                                        </a>
                                                        <div class="xsnazzy">	
                                                            <em class="point_bottom"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(1).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(1).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="cc3">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(9).getNumeroCampo()%>" class="tl">
                                                            cc3
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_bottom"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(9).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(9).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="cc4">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(8).getNumeroCampo()%>" class="tl">
                                                            cc4
                                                        </a>
                                                        <div class="xsnazzy">				
                                                            <em class="point_right"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(8).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(8).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                    <li id="cp1">
                                                        <a href="/mfm-centro-sportivo-war/GeneralController?submit=visualizzaSingoloCampo&idcampo=<%=allCamps.get(7).getNumeroCampo()%>" class="tl">
                                                            cp1
                                                        </a>
                                                        <div class="xsnazzy">
                                                            <em class="point_right"></em>
                                                            <b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
                                                                <div class="xboxcontent">
                                                                    <img src="<%=allCamps.get(7).getImmagine().replaceFirst("Images/","Campi/")%>" width="150" heigth="100"/>
                                                                    <p>Campo :<%=allCamps.get(7).getNumeroCampo()%></p>
                                                                </div>
                                                            <b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>				
                                                        </div>
                                                    </li>
                                                </ul>
                                            </div>
                                            <section class="insertModule">
                                                <h1 align="left">Verifica immediata disponibilità:</h1>
                                                <form name="listmenu0">
                                                    <table border="0" align="center">
                                                        <tr>
                                                            <th width="230px" scope="col">
                                                                <label>
                                                                    <div align="left">Tipologia Campo:</div>
                                                                </label>
                                                                <div align="left">
                                                                    <select name="firstlevel" id="tipoCampo" style="width:180px;"></select>
                                                                </div>
                                                            </th>
                                                            <th width="230px" scope="col">
                                                                <label>
                                                                    <div align="left">Tipologia Terreno:</div>
                                                                </label>
                                                                <div align="left">
                                                                    <select name="secondlevel" id="terrenoCampo" style="width:180px;"></select>
                                                                </div>
                                                            </th>
                                                            <th width="230px" scope="col">
                                                                <label>
                                                                    <div align="left">Orario Prenotazione:</div>
                                                                </label>
                                                                <div align="left">
                                                                    <select name="thirdlevel" id="orarioCampo" style="width:180px;"></select>    
                                                                </div>
                                                            </th>
                                                        </tr>
                                                        <tr>
                                                            <th colspan="3" align="right">
                                                                <input class="myButton blue" type="button" value="Ricerca" onclick="call(thirdlevel.value)"/>                        
                                                            </th>
                                                        </tr>
                                                    </table>
                                                </form>
                                            </section>
                                            <div id="txtHint"></div>
                                        </div>
                                    </div>
                                    <div class="right-panel">
                                        <div class="right-panel-in">
                                            <jsp:include page="/GeneralController">
                                                <jsp:param name="submit" value="right-content"/>
                                                <jsp:param name="op" value="newsbox"/>
                                            </jsp:include>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="footer">
                                <%@include file="footer.jsp" %> 
                            </div>
                        </div>
                    </div> 
                </body>                    
            <%}%>              
</html>
